#   -*- mode: makefile; coding: utf-8; -*-
#
#   Copyright 2008 Asier Aguirre <asier.aguirre@gmail.com>
#   This file is part of Intromit.
#
#   Intromit is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   Intromit is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with Intromit.  If not, see <http://www.gnu.org/licenses/>.

LIBTOOL = @LIBTOOL@

nobase_lib_LTLIBRARIES = intromit/backends/pyintromit.la

intromit_backends_pyintromit_la_LDFLAGS= -ldl -lstdc++ -module
intromit_backends_pyintromit_la_LIBADD = \
	../../util/marshalling.lo ../../util/util.lo \
	../../util/string.lo ../../util/file_mng.lo \
	../../generators/gendata/gendata_common.lo
intromit_backends_pyintromit_la_SOURCES= \
	pymetadata.cc pymetadata.hh \
	pymetadata_global.cc pymetadata_global.hh \
	pymetadata_iface.cc pymetadata_iface.hh \
	pymetadata_container.cc pymetadata_container.hh \
	pymetadata_gc.cc pymetadata_gc.hh \
	pymetadata_vector.cc pymetadata_vector.hh

# simple rule to generate metadata info using gendata generator
intromit_FLAGS = -v0 -c ../../../etc/intromit/metadata.cfg \
		 -m ../../generators/gendata/intromit/generators/.libs/
intromit       = ../../intromit/intromit
gendata        = $(patsubst \
			intromit/backends/%.la, \
			intromit/backends/.libs/%.gendata, \
			$(nobase_lib_LTLIBRARIES))
all-local: $(gendata)
install-exec-local:
	mkdir -p $(prefix)/lib/intromit/backends
	for f in $(gendata); do \
		cp ./$$f $(prefix)/lib/intromit/backends/; \
	done
%.gendata : %.so
	$(intromit) $(intromit_FLAGS) -o $@ $<


INCLUDES = -I../../util -I../../generators/gendata $(PYTHON_INCLUDES)

EXTRA_DIST =

MAINTAINERCLEANFILES =  Makefile.in

clean-local:
	rm -rf *~ *.da *.la intromit
